<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sites</title>
<link href="/css/admin.css" rel="stylesheet" type="text/css" />
<script src="/js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function () {
		$('.commonTable tr').hover(function () {
			$(this).css('background-color', '#ffffae');
		},
        function () {
        	$(this).css('background-color', '#FFFFFF');
        });
       });
	function addur(){
		window.open('/cms/adduserrole/<?=$uid?>','','width=350,height=350,left=' + (screen.availWidth - 350) / 2 + ',top=' + (screen.availHeight - 350) / 2);
	}
	function delur(rid){
		if(confirm('确定删除？'))
			window.location = "/cms/deluserrole/<?=$uid?>/" + rid + "/ur";
	}
</script>
</head>
<body>
	<div class="listTitle"><?php if(isset($uname)) echo ($uname);?>&nbsp;的角色</div>
	
	<div><table class="commonTable" width="600" cellspacing="0" cellpadding="5" >
	    <tr>
		    <th>角色名称</th>
			<th>角色权限</th>
		    <th width="60" >
		    </th>
	    </tr>
		<?php foreach ($query->result_array() as $row){?>
			<tr>
			<td><?=$row['rolename']?></td>
			<td><?php switch ($row['rolelevel']){
				case 0:
					echo('编辑文档');
					break;
				case 1:
					echo('审核文档');
					break;
				case 2:
					echo('全部');
					break;
			}?></td>
			<td><a href="javascript:delur('<?=$row['roleid']?>') ">删除</a></td>
			</tr>
		<?php } ?>
	</table></div>
	<div style="margin-top:10px;"><input type="button" value="添加角色" onclick="addur()" />&nbsp;&nbsp;<input type="button" value="返回" onclick="window.location='/cms/users'" /></div>
</body>
</html>